

package controller;




import bo.BUS_KhachHang;
import com.opensymphony.xwork2.ActionSupport;
import dto.DTO_KhachHang;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.interceptor.ServletRequestAware;





public class CapNhatKHAction extends ActionSupport implements ServletRequestAware {

    private String HoTen;
    private String MatKhau;
    private int GioiTinh;
    private String DiaChi;
    private String Email;
    private String DienThoai;
    private int QuyenHan;

    private HttpServletRequest request;

    public CapNhatKHAction() {

    }

    public String getDiaChi() {
        return DiaChi;
    }

    public void setDiaChi(String DiaChi) {
        this.DiaChi = DiaChi;
    }

    public String getDienThoai() {
        return DienThoai;
    }

    public void setDienThoai(String DienThoai) {
        this.DienThoai = DienThoai;
    }

    public String getEmail() {
        return Email;
    }

    public void setEmail(String Email) {
        this.Email = Email;
    }

    public int getGioiTinh() {
        return GioiTinh;
    }

    public void setGioiTinh(int GioiTinh) {
        this.GioiTinh = GioiTinh;
    }

    public String getHoTen() {
        return HoTen;
    }

    public void setHoTen(String HoTen) {
        this.HoTen = HoTen;
    }

    public String getMatKhau() {
        return MatKhau;
    }

    public void setMatKhau(String MatKhau) {
        this.MatKhau = MatKhau;
    }

    public int getQuyenHan() {
        return QuyenHan;
    }

    public void setQuyenHan(int QuyenHan) {
        this.QuyenHan = QuyenHan;
    }




    public String execute() throws Exception {

        DTO_KhachHang kh = new DTO_KhachHang();
        kh.setMaKH(Integer.parseInt(request.getParameter("MaKH")));
        kh.setMatkhau(MatKhau);
        kh.setHoTen(HoTen);
        kh.setGioiTinh(GioiTinh);
        kh.setDiaChi(DiaChi);
        kh.setEmail(Email);
        kh.setDienThoai(DienThoai);
        kh.setQuyenHan(QuyenHan);
        
        BUS_KhachHang busKH = new BUS_KhachHang();
        
        boolean flag = busKH.CapNhatKHQL(kh);
        
        if(flag == true)
        {
             return "success";
        }
        return "fail";

        

    }

    @Override
    public void setServletRequest(HttpServletRequest hsr) {
        request = hsr;
    }



}